package com.xiao.example.consumer;

import com.xiao.example.common.model.User;
import com.xiao.example.common.service.UserService;
import com.xiao.xiaorpc.config.RpcConfig;
import com.xiao.xiaorpc.proxy.ServiceProxyFactory;
import com.xiao.xiaorpc.utils.ConfigUtils;

/**
 * 简易服务消费者示例
 *
 */
public class ConsumerExample {

    public static void main(String[] args) throws InterruptedException {
        //Thread.sleep(10000);
        for(int i=0;i<3;i++){
            UserService userService = ServiceProxyFactory.getProxy(UserService.class);
            User user = new User();
            user.setName("xiao");
            // 调用
            User newUser = userService.getUser(user);
            if (newUser != null) {
                System.out.println("服务调用成功");
                System.out.println(newUser.getName());
            } else {
                System.out.println("user == null");
            }
        }





//        short number = userService.getNumber();
//        System.out.println(number);
    }
}
